#!/bin/bash
# Created by http://halucok.me
# Modified by GEO
red='\e[1;31m'
green='\e[0;32m'
NC='\e[0m'
MYIP=$(wget -qO- icanhazip.com);
echo "Connecting to Server..."
sleep 0.4
echo "CEK IZIN..."
sleep 0.3
CEK=GEO
if [ "$CEK" != "GEO" ]; then
		echo -e "${red}Permission Denied!${NC}";
        echo $CEK;
        exit 0;
else
echo -e "${green}Permission Accepted...${NC}"
sleep 1
clear
fi

IP=$(wget -qO- ipv4.icanhazip.com)
ssl="$(cat ~/log-install.txt | grep -w "Stunnel4" | cut -d: -f2)"
sqd="$(cat ~/log-install.txt | grep -w "Squid" | cut -d: -f2)"
ovpn="$(netstat -nlpt | grep -i openvpn | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
ovpn2="$(netstat -nlpu | grep -i openvpn | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
clear
if [[ "$IP2" = "" ]]; then
domain=$(cat /etc/v2ray/domain)
else
domain=$IP2
fi
read -p "BERAPA BANYAK AKUN YANG AKAN DIBUAT ? : " banyakuser
read -p "BERAPA HARI ?                    : " aktif
today="$(date +"%Y-%m-%d")"
expire=$(date -d "$aktif days" +"%Y-%m-%d")
clear
echo " "
echo " "
echo " "
echo "-----------------------------------"
echo "        ACCOUNT INFORMATION        "
echo "-----------------------------------"
echo  "  - IP/Host       : $IP"
echo  "  - Domain        : ${domain}"
echo "   - OpenSSH       : 22"
echo "   - SSL/TLS       : 902, 777"
echo "   - SSLH /SSH     : 333"
echo "   - Ws TLS        : 443"
echo "   - Ws non TLS    : 2095"
echo "   - Ws Ovpn       : 2082"
echo "   - Dropbear      : 143, 109"
echo "   - OpenVPN       : 1194"
echo "   - OpenVPN       : 2200"
echo "   - OpenVPN       : 442"
echo "   - Squid Proxy   : 3128, 8080"
echo "   - Badvpn        : 7100, 7200, 7300"
echo ""
echo " Payload WS : GET / HTTP/1.1[crlf]Host: ${domain}[crlf]Upgrade: websocket[crlf][crlf]"
echo ""
echo  "PAYLOAD WS SSL : CONNECT wss://BUG/ HTTP/1.1[crlf]Host: ${domain}[crlf]Connection: Upgrade: HTTP2-Settings  > Upgrade: Go-http-client/1.1 [crlf]User-Agent: [ua][crlf]Upgrade: websocket[crlf]Expect: 100-continue[crlf][crlf]"
echo ""
echo "        LINK DOWNLOAD OVPN"
echo "        ---------------------------------"
echo ""
echo "http://${domain}:81/client-tcp-$ovpn.ovpn"
echo "http://${domain}:81/client-udp-$ovpn2.ovpn"
echo "http://${domain}:81/client-tcp-ssl.ovpn"
echo ""
echo "   Until On       : $(date -d "$aktif days" +"%d-%m-%Y")"
  echo "--------------------------------------"
for (( i=1; i <= $banyakuser; i++ ))
do
	USER=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n 1`
	useradd -M -N -s /bin/false -e $expire $USER
	PASS=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n 1`;
	echo $USER:$USER | chpasswd
	echo "$i. Username/Password: $USER"
done

  echo "--------------------------------------"
  echo " "
  echo " Script By @sampiiiiu"
  echo " "
